I'm trying to keep count of specified objects within a layout DXL. Obviously the script below will have count_ER reset for each object and display '1' for every object that meets the specified criteria instead of maintaining a count. Is there some sort of buffer equivalent I can use for maintaining a count in a layout DXL?
int count_ER = 0 stevenson - Mon Sep 09 19:06:36 EDT 2013 |
Re: dxl layout global int Hi, You can store the temporary value in a module attribute... I don't see any other way. Alain |
Re: dxl layout global int you could use a top level variable (see e.g. https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014832013#77777777-0000-0000-0000-000014832702)
But I'm not sure at what time you will want to initialize or re-initialize the variable. Perhaps you're better off with a small script that just counts all Emergency objects in the current view and that is started as a pull down menu. |
Re: dxl layout global int You want a column that shows the total number of Emergency objects in the module; same value displayed for all objects? That seems a bit out of context for a "Layout" or "Attr-DXL". You could do it easily with an Attr-DXL instead of a layout:
-Louie |
Re: dxl layout global int llandale - Tue Sep 10 13:22:03 EDT 2013 You want a column that shows the total number of Emergency objects in the module; same value displayed for all objects? That seems a bit out of context for a "Layout" or "Attr-DXL". You could do it easily with an Attr-DXL instead of a layout:
-Louie Thanks. I changed it from layout DXL to a DXL attribute and I ended up using a variation of this:
Object oAll= current string Emergency int iOffset, iLength
for oAll in m do {
if(findPlainText (Emergency, "Fire", iOffset, iLength, false)) { } It was necessary to compare the absolute number of the object so it only wrote to the correct object. Otherwise it was reading the same number in each field since the count was being reset everytime and using the initial count value for the object value. Also, I used the findPlainText to identify the text within the Emergency field since it sometimes contained unintended spaces. Otherwise I would've had to change all my Emergency types to an enumeration.
|